﻿<%@ Page Language="C#" MasterPageFile="~/movie.master" AutoEventWireup="true" CodeFile="SearchMovies.aspx.cs" Inherits="SearchMovies" %>

<%@ MasterType VirtualPath="~/movie.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
    .style1
    {
        width: 100%;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <div id="maincontent">
    <h3>Search Movies</h3>
        <br /><br />
    
    <table cellpadding="3px" cellspacing="3px" class="style1">
        <tr>
            <td colspan="2">Please enter a search criteria (e.g. movie, director or genre):
            
            </td>
        </tr>
        <tr>
           
            <td >
                <asp:TextBox ID="txtEmail" MaxLength="40" runat="server" Width="173px"></asp:TextBox> &nbsp;&nbsp;
                <asp:Button ID="btnSubmit" runat="server" Text="Search" 
                    onclick="btnSearch_Click" />
                      <asp:HyperLink ID="hlBrowsCat" runat="server" NavigateUrl="~/BrowsebyCategory.aspx" >Browse by Category</asp:HyperLink>    
         
            </td>
        </tr>
         <tr>
                    <td class="Message" >
                        <asp:Label runat="server" ID="lblmsg" ></asp:Label>   
                    </td>
           </tr>
        <tr>
        
            <td>
                  <asp:GridView ID="gvSearch" runat="server" DataKeyNames="MovieID" AutoGenerateColumns="false" Width="95%"
                    AllowPaging="true" PageSize="10" 
                            EmptyDataText="No Data to Display"                              
                            AllowSorting="true"  onrowcommand="gvSearch_RowCommand" OnPageIndexChanging="gvSearch_PageIndexChanging"  >
                           <RowStyle CssClass="GridViewItemTemplateRowStyle" />                   
                        <AlternatingRowStyle CssClass="GridViewAlternateItemTemplateRowStyle"  />
                        <EmptyDataRowStyle CssClass= "GridViewEmptyDataRowStyle"  />
                        <HeaderStyle  CssClass="GridViewHeaderStyle" />
                        <Columns>
                         <asp:TemplateField>
                                 <ItemTemplate>
                                    <asp:HiddenField id ="hdnMovieID"  runat="server" Value='<%# Bind("MovieID") %>' />
                                 </ItemTemplate>                             
                             </asp:TemplateField>                            
                      <asp:ImageField dataimageurlfield="Image" dataimageurlformatstring="images/movieImages/{0}" AlternateText ="No image on file"></asp:ImageField>
                              
                           <asp:BoundField DataField="Name" HeaderText ="Name" />
                             <asp:BoundField DataField="Director" HeaderText ="Director" />
                               <asp:BoundField DataField="Genre" HeaderText ="Genre" />                                
                                                                      
                                   <asp:CommandField ShowInsertButton="True" NewText="Add to Queue" ButtonType="Image" NewImageUrl="images/addToCart.jpg" ItemStyle-Width="10%"  ItemStyle-Height="10%"  />
                        </Columns>
                  
                  </asp:GridView>
                  <asp:SqlDataSource ID="getSearchResult" runat="server" ConnectionString="<%$ ConnectionStrings:moviesConnection %>"
                      SelectCommand="mov_getSearchResults"   SelectCommandType="StoredProcedure" >  
                      <SelectParameters>
                      <asp:Parameter name="searchtext" Direction="Input" DefaultValue ="Barney" />
                      </SelectParameters>
                    </asp:SqlDataSource>
            </td>       
        
        </tr>
        
        
        <tr>
        <td>
         <h3>New Listings</h3>
        
        </td>
                 
        </tr>
         <tr>
                    <td class="Message" >
                        <asp:Label runat="server" ID="lblmsg2" ></asp:Label>   
                    </td>
           </tr>
        <tr>
            <td>
                <asp:GridView ID="gvNewListings" runat="server" DataKeyNames="MovieID" AutoGenerateColumns="false" Width="95%"
                    AllowPaging="false" PageSize="10" 
                            EmptyDataText="No Data to Display"                              
                            AllowSorting="true"  onrowcommand="gvNewListings_RowCommand"  >
                           <RowStyle CssClass="GridViewItemTemplateRowStyle" />                   
                        <AlternatingRowStyle CssClass="GridViewAlternateItemTemplateRowStyle"  />
                        <EmptyDataRowStyle CssClass= "GridViewEmptyDataRowStyle"  />
                        <HeaderStyle  CssClass="GridViewHeaderStyle" />
                        <Columns>
                         <asp:TemplateField>
                                 <ItemTemplate>
                                    <asp:HiddenField id ="hdnMovieID2"  runat="server" Value='<%# Bind("MovieID") %>' />
                                 </ItemTemplate>                             
                             </asp:TemplateField>                            
                        <asp:ImageField dataimageurlfield="Image" dataimageurlformatstring="images/movieImages/{0}" NullDisplayText="No image on file"></asp:ImageField>
                               
                           <asp:BoundField DataField="Name" HeaderText ="Name" />
                             <asp:BoundField DataField="Director" HeaderText ="Director" />
                               <asp:BoundField DataField="Genre" HeaderText ="Genre" />                                                                   
                                           <asp:CommandField ShowInsertButton="True" NewText="Add to Queue" ButtonType="Image" NewImageUrl="images/addToCart.jpg"   />
                                             
                         
                         </Columns>
                  </asp:GridView>
                <asp:SqlDataSource ID="getNewListings" runat="server" ConnectionString="<%$ ConnectionStrings:moviesConnection %>"
                  SelectCommand="mov_getNewListings" SelectCommandType="StoredProcedure" >                  
                </asp:SqlDataSource>
            </td>
          
        </tr>
        <tr>
           
            <td>
              </td>
        </tr>
        <tr>
           
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            
            <td>
                &nbsp;</td>
        </tr>
    </table>
    
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="RightContent" Runat="Server">
</asp:Content>



